// 前置模板

tabs();
//pic
var goods_img = $('#goods-img'),
	goods_url = encodeURIComponent(document.location.href);
$('#goods_imgs img').bind('mouseover click',function(){ goods_img[0].src=this.src});
goods_img.click(function(){window.open(this.src)});

//buy
var u_cartAdd = ROOT_URL +'?u=cshop\\cart-fadd';
$('#btn_add_buy_g').click(function(){
	$.get(u_cartAdd, $('#buy_cartpost').serialize()  +'&pic='+ encodeURIComponent(goods_img[0].src) ,function(r){if(checAjaxRe(r))box(language._('OK')).close(0.3);});
});
$('#btn_buy_goods').click(function(){
	document.location.href = u_cartAdd + '&next&' + $('#buy_cartpost').serialize() +'&pic='+ encodeURIComponent(goods_img[0].src);
});

//log
$.get(ROOT_URL +'?u=clog\\access\\add', 'url=' + goods_url + '&h1=' + encodeURIComponent($('h1').eq(1).text())  + '&pic=' + encodeURIComponent(goods_img[0].src));


//fav
$('#btn_fav_goods').click(function(){
var d = 'd[url]=' + goods_url +
		'&d[title]=' + encodeURIComponent($('h1').eq(1).text())  +
		'&d[pic]=' + encodeURIComponent(goods_img[0].src);
$.post(ROOT_URL +'?u=cuser\\favorite-fadd', d, function(r){if(checAjaxRe(r))box(language._('OK')).close(0.3);});
});